while (!Q->isEmpty()) {
const Waypoint* wpt = Q->takeFirst();
if (wpt->extra_data) {
- // FIXME
// wpt->extra_data may be holding a pointer to a QString, courtesy
- // the grossness at the end of write_waypt_cb(). If that leaks,
- // (and I think it will) find some way to do the approximate equivalent
- // of:
- // delete static_cast<QString*>(wpt->extra_data);
+ // the grossness at the end of write_waypoint_cb().
+ delete static_cast<QString*>(wpt->extra_data);
}
delete wpt;
}
RAD(tmp->latitude), RAD(tmp->longitude)));
if (fabs(dist) > 100) {
- warning(MYNAME ": Route point mismatch!\n");
- warning(MYNAME ": \"%s\" from waypoints differs to \"%s\"\n",
- qPrintable(tmp->shortname), qPrintable(ref->shortname));
- fatal(MYNAME ": from route table by more than %0.1f meters!\n",
- dist);
-
+ fatal(MYNAME ": Route point mismatch!\n" \
+ " \"%s\" from waypoints differs to \"%s\"\n" \
+ " from route table by more than %0.1f meters!\n", \
+ qPrintable(tmp->shortname), qPrintable(ref->shortname), dist);
}
}
Waypoint* res = nullptr;
garmin_fs_t* gmsd = garmin_fs_t::find(wpt);
/* extra_data may contain a modified shortname */
- FWRITE_CSTR((wpt->extra_data) ? (char*)wpt->extra_data : wpt->shortname);
+ FWRITE_CSTR((wpt->extra_data) ? *static_cast<QString*>(wpt->extra_data) : wpt->shortname);
int wpt_class = wpt->wpt_flags.fmt_use; /* trick */
}
name = mkshort(short_h, name);
+ wpt->extra_data = new QString(name);
write_waypoint(wpt, name, gmsd, icon, display);
finalize_item(fsave, 'W');
--- /dev/null
+name,lat,lon
+RoutePoint,40.00,-105.00
+RoutePoint,40.01,-105.00
+RoutePoint,40.01,-105.01
+RoutePoint,40.02,-105.01
+
--- /dev/null
+No,Latitude,Longitude,Name,Symbol\r
+1,40.000000,-105.000000,"RoutePoint","Waypoint"\r
+2,40.010000,-105.000000,"RoutePoint.1","Waypoint"\r
+3,40.010000,-105.010000,"RoutePoint.2","Waypoint"\r
+4,40.020000,-105.010000,"RoutePoint.3","Waypoint"\r
# don't choke if autoroute information is present.
gpsbabel -i gdb,dropwpt -f ${REFERENCE}/gdb-sample-v3-autoroute.gdb -o gpx -F ${TMPDIR}/gdb-sample-v3-autoroute.gpx
compare ${REFERENCE}/gdb-sample-v3-autoroute.gpx ${TMPDIR}/gdb-sample-v3-autoroute.gpx
+
+# test that the Route point Point names from the 'R' records match the Waypoint names from the 'W' records.
+# the names in the csv input are all identical which forces the gdb writer to uniquify them.
+gpsbabel -r -i unicsv -f ${REFERENCE}/route/gdbroutenametest.csv -o gdb -F ${TMPDIR}/gdbroutenametest.gdb
+# if we don't match the names we will get a fatal error:
+# gdb: Route point mismatch!
+# "RoutePoint" from waypoints differs to "RoutePoint"
+# from route table by more than 1113.2 meters!
+gpsbabel -r -i gdb -f ${TMPDIR}/gdbroutenametest.gdb -o unicsv -F ${TMPDIR}/gdbroutenametest.csv
+compare ${REFERENCE}/route/gdbroutenametest~csv.csv ${TMPDIR}/gdbroutenametest.csv